import React, {Component} from 'react';

import "../../styles/ValueSell.css"
import {withRouter} from 'react-router-dom'
import {index_goodlist,good_goodinfo} from '../../api'
class ValueSell extends Component{
    constructor(props){
        super(props);
        this.state={
            list : [
                // {name:'Filorga菲洛品米...',index:20,price1:303,price2:195},
                // {name:'CLINIQUE倩碧...',index:21,price1:924,price2:675},
                // {name:'La Mer海蓝之...',index:22,price1:2826,price2:2543},
                // {name:'Giorgio Armani...',index:23,price1:430,price2:413},
                // {name:'Panier Des sen...',index:24,price1:110,price2:93},
                // {name:'Ulike 蓝宝石冰...',index:25,price1:1749,price2:1487},
                // {name:'Filorga菲洛品米...',index:25,price1:303,price2:139},
                // {name:'Filorga菲洛品米...',index:25,price1:303,price2:139},
                // {name:'Filorga菲洛品米...',index:25,price1:303,price2:139},
            ],
            currrentIndex:0
        }
    }
    componentDidMount(){
        index_goodlist().then((res)=>{
            console.log("推荐",res.data)
            this.setState({
                list:res.data.list,
            })
        })
    }
    handleClick(id){
        console.log(id)
        this.props.history.push(`/detail/${id}`)
          
            // console.log(this.state.list[index].id);
      
    }
    render(){
        return(
            <div className='sell'>
                <img src={require('../../images/images/19.jpg')} alt="" />
                <div className='b1'>
                {
                        this.state.list.map((item,index)=>{
                            return (
                                <div className='b' onClick={()=>{
                                    this.handleClick(item.id)
                                }} key={item.id}>
                                <img src={item.pic} alt="" />
                            <p>{item.name}</p>
                            <span className='p1'>原价:￥{item.salesPrice.value}</span>
                            {/* <span className='p2'>抢购价:￥<i>{item.salesPrice.value}</i></span> */}
                            </div>
                            )
                        })
                    }
                </div>
            </div>
        )
    }
}

export default withRouter(ValueSell);